using System;
using System.Collections.Generic;
using System.Text;
using My.IdlConverter.Core;
using My.IdlConverter.Core.Util;

namespace My.IdlConverter.Com
{
//    [
//    object,
//    uuid(D497F922-393E-40dd-B9C4-442DBF48EB01),
//    dual,
//    helpstring("IComponentRegistrar Interface"),
//    pointer_default(unique)
//]
//interface IComponentRegistrar : IDispatch
//{
//    [id(1)]	HRESULT Attach([in] BSTR bstrPath);
//    [id(2)]	HRESULT RegisterAll();
//    [id(3)]	HRESULT UnregisterAll();
//    [id(4)]	HRESULT GetComponents([out] SAFEARRAY(BSTR)* pbstrCLSIDs, [out] SAFEARRAY(BSTR)* pbstrDescriptions);
//    [id(5)]	HRESULT RegisterComponent([in] BSTR bstrCLSID);
//    [id(6)]	HRESULT UnregisterComponent([in] BSTR bstrCLSID);
//};
    internal sealed class ComComponentRegistar
    {
        public static StringBuilder Declaration
        {

            get
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("[");
                sb.AppendLine(StringUtil.FormatIndent1("object,"));
                sb.AppendFormat(StringUtil.FormatIndent1("uuid({0}),{1}", ComGuidCenter.Apply("IRegistar"), Environment.NewLine));
                sb.AppendLine(StringUtil.FormatIndent1("dual,"));
                sb.AppendLine(StringUtil.FormatIndent1("helpstring(\"IComponentRegistrar Interface\"),"));
                sb.AppendLine(StringUtil.FormatIndent1("pointer_default(unique)"));
                sb.AppendLine("]");
                sb.AppendLine("interface IComponentRegistrar : IDispatch");
                sb.AppendLine("{");
                sb.AppendLine(StringUtil.FormatIndent1("[id(1)]	HRESULT Attach([in] BSTR bstrPath);"));
                sb.AppendLine(StringUtil.FormatIndent1("[id(2)]	HRESULT RegisterAll();"));
                sb.AppendLine(StringUtil.FormatIndent1("[id(3)]	HRESULT UnregisterAll(); "));
                sb.AppendLine(StringUtil.FormatIndent1("[id(4)]	HRESULT GetComponents([out] SAFEARRAY(BSTR)* pbstrCLSIDs, [out] SAFEARRAY(BSTR)* pbstrDescriptions);"));
                sb.AppendLine(StringUtil.FormatIndent1("[id(5)]	HRESULT RegisterComponent([in] BSTR bstrCLSID);"));
                sb.AppendLine(StringUtil.FormatIndent1("[id(6)]	HRESULT UnregisterComponent([in] BSTR bstrCLSID);"));
                sb.AppendLine("}");

                return sb;
            }
        }
    }
}
